package com.hl.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hl.sfzy.entity.Heartk;
import com.hl.sfzy.mapper.HeartkMapper;
import com.hl.sfzy.service.HeartkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HeartkServiceImpl implements HeartkService {

    @Autowired
    private HeartkMapper heartkMapper;

    @Override
    public int removeByPrimaryKey(Integer id) {
        return heartkMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int removeBatch(List<Long> ids) {
        return heartkMapper.removeBatch(ids);
    }

    @Override
    public int add(Heartk heartk) {
        return heartkMapper.insert(heartk);
    }



    @Override
    public Heartk findByPrimaryKey(Long id) {
        return heartkMapper.selectByPrimaryKey(id);
    }



    @Override
    public List<Heartk> find(int pageNum, int pageSize) {
        return heartkMapper.find(pageNum,pageSize);
    }

    @Override
    public PageInfo<Heartk> findByPage(int pageNum, int pageSize, Heartk heartk) {
        PageHelper.startPage(pageNum,pageSize);
        List<Heartk> heartks = heartkMapper.findByPage(pageNum,pageSize,heartk);
        PageInfo<Heartk> pageInfo = new PageInfo<>(heartks);
        return pageInfo;
    }


    @Override
    public int editByPrimaryKey(Heartk heartk) {
        return heartkMapper.updateByPrimaryKey(heartk);
    }
}
